<?php

namespace app\admin\controller;

use app\model\UsersSessions;
use think\facade\Cache;

class ClearcacheController extends Base
{

	public function index()
	{
		
		try {
			UsersSessions::where('token', '<>', $this->getToken())->delete();
			deldir(app()->getRootPath() . 'runtime/cache');
		} catch (\Exception $e) {
			abort(config('my.error_log_code'), $e->getMessage());
		}

		return $this->json(['data' => '清除缓存功成!']);
	}
}
